package com.cskaoyan.controller;

import com.cskaoyan.module.bean.BaseRespVo;
import com.cskaoyan.module.bo.CategortUpdateBO;
import com.cskaoyan.module.pojo.MarketCategory;
import com.cskaoyan.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created with IntelliJ IDEA.
 *
 * @Description:
 * @Author: 周佳豪
 * @Date: 2022/04/08/10:19
 */
@RestController
@RequestMapping("admin")
public class CategoryController {

    @Autowired
    CategoryService categoryService;

    @GetMapping("category/l1")
    public BaseRespVo categoryl1() {
        BaseRespVo baseRespVo = categoryService.categoryL1();
        return baseRespVo;
    }

    @GetMapping("category/list")
    public BaseRespVo categoryList() {
        BaseRespVo baseRespVo = categoryService.categoryList();
        return baseRespVo;
    }

    @PostMapping("category/create")
    public BaseRespVo categoryCreate(@RequestBody MarketCategory marketCategory) {
        BaseRespVo baseRespVo = categoryService.categoryCreate(marketCategory);
        return baseRespVo;
    }
    @PostMapping("category/update")
    public BaseRespVo categoryUpdate(@RequestBody CategortUpdateBO categortUpdateBO) {
        BaseRespVo baseRespVo = categoryService.categoryUpdate(categortUpdateBO);
        return baseRespVo;
    }
    @PostMapping("category/delete")
    public BaseRespVo categoryDelete(@RequestBody CategortUpdateBO categortUpdateBO) {
        BaseRespVo baseRespVo = categoryService.categoryDelete(categortUpdateBO);
        return baseRespVo;
    }
}
